<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', [
    'namespace' => 'App\Http\Controllers\Api'
], function ($api) {
    $api->get('version', function () {
        return response('this is version vv1');
    });
    // 图片资源
    $api->post('images', 'ImagesController@store')
        ->name('api.images.store');
    // 长连接转短链接
    $api->get('long2short', 'UtilsController@longUrl2ShortUrl')
        ->name('api.utils.long2short');
    $api->post('long2short', 'UtilsController@longUrl2ShortUrl')
        ->name('api.utils.long2short');

    // 发送邮件
    $api->get('mail', 'MailController@store')
        ->name('api.mail.store');
    $api->post('mail', 'MailController@store')
        ->name('api.mail.store');
    // 获取二维码
    $api->get('get_qrcode', 'UtilsController@getQRCode')
        ->name('api.utils.get_qrcode');
    $api->post('get_qrcode', 'UtilsController@getQRCode')
        ->name('api.utils.get_qrcode');

});

$api->version('v2', function ($api) {
    $api->get('version', function () {
        return response('this is version v2');
    });
});


